home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / hc / tictacto.sit / tic tac toe / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1988-11-14  |  4.0 KB  |  16 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>1</cardCount>
  7.     <cardID>2866</cardID>
  8.     <listID>2154</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>on update
  17. global player,err
  18. if player is 1 then
  19. if err is 0 then
  20. set hilite of card button "player 1" to false
  21. set hilite of card button "player 2" to true
  22. put empty into line 1 to 2 of card field 1
  23. put empty into line 1 to 2 of card field 2
  24. put "Your turn!" & return & "==========" & return into line 1 of card field 2
  25. put "Wait!" & return & "==========" ┬¼
  26. & return into line 1 of card field 1
  27. put 2 into player
  28. end if
  29. else
  30. if err is 0 then
  31. set hilite of card button "player 2" to false
  32. set hilite of card button "player 1" to true
  33. put empty into line 1 to 2 of card field 1
  34. put empty into line 1 to 2 of card field 2
  35. put "Your turn!" & return & "==========" & return into line 1 of card field 1
  36. put "Wait!" & return ┬¼
  37. & "==========" & return into line 1 of card field 2
  38. put 1 into player
  39. end if
  40. end if
  41. put 0 into err
  42. updatescore
  43. end update
  44.  
  45. on updatescore
  46. global board,play1tot,play2tot
  47. put 0 into play1tot
  48. put 0 into play2tot
  49. repeat with i = 1 to 9
  50. if item i of board is 1 then
  51. add 1 to play1tot
  52. else
  53. if item i of board is 2 then
  54. add 1 to play2tot
  55. end if
  56. end if
  57. end repeat
  58. put play1tot into card field "play1score"
  59. put play2tot into card field "play2score"
  60. wincheck
  61. end updatescore
  62.  
  63. on wincheck
  64. global play1tot,play2tot,board,win
  65. if play1tot + play2tot > 4 then
  66. put 0 into tot
  67. add item 1 of board to tot
  68. add item 2 of board to tot
  69. add item 3 of board to tot
  70. if tot is 3 then player1won 1,2,3
  71. if tot is 6 then player2won 1,2,3
  72. put 0 into tot
  73. add item 4 of board to tot
  74. add item 5 of board to tot
  75. add item 6 of board to tot
  76. if tot is 3 then player1won 4,5,6
  77. if tot is 6 then player2won 4,5,6
  78. put 0 into tot
  79. add item 7 of board to tot
  80. add item 8 of board to tot
  81. add item 9 of board to tot
  82. if tot is 3 then player1won 7,8,9
  83. if tot is 6 then player2won 7,8,9
  84. put 0 into tot
  85. add item 1 of board to tot
  86. add item 5 of board to tot
  87. add item 9 of board to tot
  88. if tot is 3 then player1won 1,5,9
  89. if tot is 6 then player2won 1,5,9
  90. put 0 into tot
  91. add item 3 of board to tot
  92. add item 5 of board to tot
  93. add item 7 of board to tot
  94. if tot is 3 then player1won 3,5,7
  95. if tot is 6 then player2won 3,5,7
  96. put 0 into tot
  97. add item 1 of board to tot
  98. add item 4 of board to tot
  99. add item 7 of board to tot
  100. if tot is 3 then player1won 1,4,7
  101. if tot is 6 then player2won 1,4,7
  102. put 0 into tot
  103. add item 2 of board to tot
  104. add item 5 of board to tot
  105. add item 8 of board to tot
  106. if tot is 3 then player1won 2,5,8
  107. if tot is 6 then player2won 2,5,8
  108. put 0 into tot
  109. add item 3 of board to tot
  110. add item 6 of board to tot
  111. add item 9 of board to tot
  112. if tot is 3 then player1won 3,6,9
  113. if tot is 6 then player2won 3,6,9
  114. if (win is 0) and (9 is not in board) then
  115. play "c"
  116. play "a"
  117. play "t"
  118. put empty into card field 2
  119. put empty into card field 1
  120. repeat 12
  121. put "Cat's Game!" & return after card field 2
  122. put "Cat's Game!" & return after card field 1
  123. end repeat
  124. put 1 into win
  125. flash 5
  126. exit to hypercard
  127. end if
  128. end if
  129. end wincheck
  130.  
  131. on player1won x,y,z
  132. displaywin x,y,z
  133. add 1 to card field win1score
  134. put empty into card field 1
  135. put empty into card field 2
  136. repeat 12
  137. put "You win!" & return after card field 1
  138. put "You lose!" & return after card field 2
  139. end repeat
  140. end player1won
  141.  
  142. on player2won x,y,z
  143. displaywin x,y,z
  144. add 1 to card field win2score
  145. put empty into card field 2
  146. put empty into card field 1
  147. repeat 12
  148. put "You win!" & return after card field 2
  149. put "You lose!" & return after card field 1
  150. end repeat
  151. end player2won
  152.  
  153. on displaywin x,y,z
  154. global win
  155. play "harpsichord" tempo 120 "c5e gq fe3 ee3 de3 ce gq fe3 ee3 de3 ce gq fe3 ee3 fe3 deq"
  156. repeat 5
  157. set hilite of card button x to true
  158. set hilite of card button y to true
  159. set hilite of card button z to true
  160. se